<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page isELIgnored="false" %>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="author" content="order by dede58.com"/>
    <title>个人信息</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" type="text/css" href="common/layui/css/layui.css" media="all">
    <link rel="stylesheet" type="text/css" href="common/bootstrap/css/bootstrap.css" media="all">
    <link rel="stylesheet" type="text/css" href="common/global.css" media="all">
    <link rel="stylesheet" type="text/css" href="css/personal.css" media="all">
    <script src="js/jquery2.js"></script>
</head>
<body>
<section class="layui-larry-box">
    <div class="larry-personal">
        <div class="layui-tab">
            <%--<blockquote class="layui-elem-quote news_search">

                <div class="layui-inline">
                    <div class="layui-input-inline">
                        <input value="" placeholder="请输入关键字" class="layui-input search_input" type="text">
                    </div>
                    <a class="layui-btn search_btn">查询</a>
                </div><div class="layui-inline">
                <a class="layui-btn layui-btn-normal newsAdd_btn">添加文章</a>
            </div>
                <div class="layui-inline">
                    <a class="layui-btn recommend" style="background-color:#5FB878">推荐文章</a>
                </div>
                <div class="layui-inline">
                    <a class="layui-btn audit_btn">审核文章</a>
                </div>
                <div class="layui-inline">
                    <a class="layui-btn layui-btn-danger batchDel">批量删除</a>
                </div>
                <div class="layui-inline">
                    <div class="layui-form-mid layui-word-aux">本页面刷新后除新添加的文章外所有操作无效，关闭页面所有数据重置</div>
                </div>
            </blockquote>--%>

            <!-- 操作日志 -->
            <div class="layui-form news_list">
                <table class="layui-table">
                    <thead>
                    <tr>
                        <th>选择</th>
                        <th style="text-align:left;">部门编号</th>
                        <th>部门名称</th>
                        <th>上级部门</th>
                        <th>部门负责人</th>
                        <th>部门电话</th>
                        <th>部门传真</th>
                        <th>部门邮箱</th>
                        <th>部门职责</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody id="tbody">

                    </tbody>
                    <script>
                        $(function () {
                            $.ajax({
                                type: "get",
                                url: "dept/queryAll",
                                dataType: "json",
                                success: function (data) {
                                    $.each(data, function (index, da) {
                                        var rows = "<tr>" +
                                            "<th><input type='checkbox'style='display: block;' value='" + da.id + "' name='id' /></th>" +
                                            "<th>" + da.dbian + "</th>" +
                                            "<th>" + da.dname + "</th>" +
                                            "<th>" + da.wname + "</th>" +
                                            "<th>" + da.dmanager + "</th>" +
                                            "<th>" + da.dtel + "</th>" +
                                            "<th>" + da.dfax + "</th>" +
                                            "<th>" + da.demail + "</th>" +
                                            "<th>" + da.duty + "</th>" +
                                            "<th><button class='btn btn-group-xs btn-info' onclick='del();'>删除</button></th>" +
                                            "</tr>";
                                        $("#tbody").append(rows);
                                    })
                                },
                                error: function () {
                                    window.location.href = "404.jsp";
                                }
                            });
                        });

                        function del() {
                            alert("确认删除吗?");
                            var idElement = $("[name='id']");
                            var idValue = null;
                            var s = 0;
                            for (var i = 0; i < idElement.length; i++) {
                                if (idElement[i].checked == true) {
                                    s++;
                                    if (s > 1) {
                                        alert("对不起,一次只能删除一个!!!");
                                        return;
                                    }
                                    idValue = idElement[i].value;
                                }
                            }
                            if (s == 0) {
                                alert("请选择")
                            } else {
                                $.ajax({
                                    url: "${pageContext.request.contextPath}/dept/delDeptById",
                                    type: "post",
                                    data: {
                                        "id": idValue
                                    },
                                    dataType: "",
                                    success: function (msg) {
                                        if (msg != 1) {
                                            alert("该部门下有人");
                                            window.location.href = "deletePage.jsp"
                                        } else {
                                            window.location.href = "showDeptData.jsp";
                                        }
                                    },
                                    error: function () {
                                        window.location.href = "404.jsp"
                                    }
                                });
                            }
                        }
                    </script>
                </table>
            </div>
        </div>
    </div>
    </div>
</section>

<script src="js/tao.js"></script>

<script>
    $(document).ready(function (e) {
        /*禁止右键和隐藏鼠标*/
        $("body").bind("contextmenu", function () {
            return false;
        });

        /*定义文字最底部显示到哪儿*/
        var guangs = ["　", "|", "　", "|"];
        var guangBiao = "/";
        var guangSub = 0;
        var guang = setInterval("$.guang()", 120);

        var subs = 0;
        var string = "某人…… ██我喜欢你██真的很喜欢很喜欢你███你知道吗…每个噩梦惊醒的夜晚...总会依赖的想起你██每当夜深人静想起你的时候……眼泪总是忍不住的往下流██每当流星划过寂静的天边……都会为你许下祝福的心愿██我依旧对你那么思念██不管你怎么样……我对你的爱永远不会改变██我只是个很普通的人……可能配不上你██如果因为我的表白而影响你的学习……那很抱歉……██我可以等你……不管3年还是5年……██████████PS.青春美好——算了吧。。再弄也是白费力气的。。她是不可能接受的。。。我想了很多。。。也许。。她从来没有想过。。也从来没有一点点的喜欢我。。。██我。。真的很差。。。████████我希望你能够答应我 <-- The End -->";
        $.intent = function (str) {
            str = "　　" + str;
//        var reg=new RegExp("/█{1,2}/","i"); //创建正则RegExp对象
            str = str.replace(eval("/█/gi"), "█");

            return str;
        }
        string = $.intent(string);

        var echo = setInterval("$.echo()", 300);

        $.guang = function () {
            if (guangSub < guangs.length - 1) {
                guangSub++;
            } else {
                guangSub = 0;
            }
            guangBiao = guangs[guangSub];
            $("#guang").html(guangBiao);

        }

        // $.echo=function(){
        //     if(subs<string.length){
        //         $("#txt").html($("#txt").html()+$.repl(string.substr(subs,1)));
        //         if($("#guang").offset().top > document.body.scrollHeight / 2){
        //             window.scrollTo(0,$("#guang").offset().top);
        //         }
        //         $(".des").css("bottom","0px");
        //         subs++;
        //     }
        // }
        $.repl = function (str) {
            str = str.replace("\r\n", "<br/>");
            str = str.replace("\n", "<br/>");
            str = str.replace("█", "<br/>");
            return str;
        }
    });
</script>
<div id="bubbles" style="visibility:hidden">
    <img src="${pageContext.request.contextPath}/images/1.png">
    <img src="${pageContext.request.contextPath}/images/2.png">
    <img src="${pageContext.request.contextPath}/images/1.png">
</div>
</body>
</html>